package com.example.mapper;

import com.example.pojo.Product;
import com.example.pojo.ShoppingCar;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

/**
 * @Description:
 * @author: GaoPeng
 * @date: 2021/5/26 21:31
 */
public interface ProductMapper extends Mapper<Product> {

    @Select("select seller from Product where id=#{id}")
    Integer selectSellerById(Integer id);

    @Update("update Product set name=#{name},brief=#{brief} where id=#{id}")
    Integer updateProduct(@Param("id")Long id,@Param("name")String name,@Param("brief")String brief);

    @Delete("delete from Product where id=#{id}")
    Integer deleteProduct(Long id);

    @Select("select * from Product where name=#{name}")
    List<Product> selectByName(String name);
}
